package com.life.wd.mapper;

import com.github.pagehelper.Page;
import com.life.wd.dto.CommunityPostQueryRequest;
import com.life.wd.entity.CommunityPosts;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CommunityPostMapper {
    /**
     * 插入帖子
     */
    void insert(CommunityPosts post);

    /**
     * 分页查询帖子列表
     */
    Page<CommunityPosts> listPosts(CommunityPostQueryRequest request);

    /**
     * 根据ID获取帖子
     */
    CommunityPosts getPostById(Integer postId);

    /**
     * 根据ID删除帖子
     */
    int deletePost(@Param("postId") Integer postId);

    /**
     * 批量删除帖子
     */
    int deletePostsBatch(@Param("postIds") List<Integer> postIds);
}